import fetch from "@/utils/fetch";
const prefix = "/formService/form";

export const formFillQuery = (params: API.Form.FormFillQueryParams) =>
  fetch<API.Form.FormFillQueryResult>({
    method: "post",
    url: `${prefix}/fill/query`,
    params,
    name: "填写记录查询接口",
  });

export const addForm = (params: API.Form.AddFormParams) =>
  fetch<{
    formId: string;
  }>({
    method: "post",
    url: `${prefix}/createFormInfo`,
    params,
    name: "创建表单",
  });

export const editForm = (params: API.Form.AddFormParams) =>
  fetch<API.Success>({
    method: "post",
    url: `${prefix}/updateFormInfo`,
    params,
    name: "编辑表单",
  });

export const formDetail = (formId: string) =>
  fetch<API.Form.FormDetailResult>({
    method: "get",
    url: `${prefix}/info`,
    params: { formId },
    name: "表单详情查询",
  });

export const formFill = (params: API.Form.FormFillParams) =>
  fetch<API.Success>({
    method: "post",
    url: `${prefix}/fill`,
    params,
    name: "表单填写接口",
  });
